package com.custom.windows;

import android.content.Context;
import android.view.Gravity;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup.LayoutParams;
import android.widget.Button;
import android.widget.EditText;
import android.widget.TextView;

import com.smartnsoft.fractory.R;

public class AskSaveProjectPopup extends CustomPopupWindow
{

  private Context context;

  private LayoutInflater inflater;

  public Button askSaveProjectSaveButton;
  
  public Button askSaveProjectDontSaveButton;

  public Button askSaveProjectCancelButton;

  public TextView askSaveProjectNumber;

  public TextView askSaveProjectTitle;

  private View root;

  public EditText askSaveProjectEditText;



  public AskSaveProjectPopup(View anchor)
  {
    super(anchor);
    context = anchor.getContext();
    inflater = (LayoutInflater) context.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
  }

  public void setRootView(int ressources)
  {
    root = inflater.inflate(ressources, null);
    setContentView(root);
    askSaveProjectSaveButton = (Button) root.findViewById(R.id.saveButtonAskSaveProject);
    askSaveProjectCancelButton = (Button) root.findViewById(R.id.cancelButtonAskSaveProject);
    askSaveProjectDontSaveButton = (Button) root.findViewById(R.id.dontSaveButtonAskSaveProject);
  }

  /**
   * Show popup window
   */
  public void show()
  {
    preShow();
    root.setLayoutParams(new LayoutParams(LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT));
    root.measure(LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT);
    window.showAtLocation(this.anchor, Gravity.CENTER, 0, 0);
  }

}